<?php

namespace app\api\controller;

use think\Controller;
use think\facade\Session;
use think\Request;

class Api extends Controller
{
    //查看答案
    public function ask(){
        if(Session::has('main_user')){
            if($this->request->isPost()){
                $id = $this->request->param('id/d');
                $q = new \app\common\model\Api();
                $answer = $q->get_ask($id);
                return json_ask($answer['code'],$answer['msg'],$answer['answer']);
            }
            return json_ask(-1,'请正确请求','');
        }
        return json_ask(-2,'请先登陆账号才可以查看答案','');
    }
}
